class SingtetonLazy{
    private static volatile SingtetonLazy instance=null;
    private static Object locker=new Object();

    public static SingtetonLazy getInstance(){
        if(instance==null){
            synchronized (locker) {
                if (instance == null) {
                    instance = new SingtetonLazy();
                }
            }
        }

         return instance;
    }
    private SingtetonLazy(){

    }
}

public class Demo2 {
    public static void main(String[] args) {
        SingtetonLazy s1=SingtetonLazy.getInstance();
        SingtetonLazy s2=SingtetonLazy.getInstance();
        System.out.println(s1==s2);
    }
}
